package com.frank.demo.zookeeper.curator.zk;

/**
 * Created by zhy on 2018/5/2.
 */
public abstract class AbstractZkHandler implements ZkHandle {
    protected String path = null;
    protected String self = null;
    protected String selfPath = null;
    protected String zkAddress = null;

    @Override
    public String path() {
        return path;
    }

    @Override
    public String zkAddress() {
        return zkAddress;
    }

    @Override
    public String self() {
        return self;
    }

    @Override
    public String selfPath() {
        return selfPath;
    }

    @Override
    public void shutDown() throws Exception {
        System.out.println("停止该节点");
        System.exit(0);
    }

    @Override
    public void setSelf(String selfPath) {
        this.selfPath = selfPath;
        this.self = selfPath.substring(path.length() + 1);
    }


}
